MultiPrice AlertThis is an alert script using Pinescript version 4. This enables one to set 5 alerts (1 StopLoss, 4 Targets), on 3 different symbols, at using a single alert in the UI.
Every visible line will only appear on the symbols that are selected. After setting targets when making an alert, select this indicator as a condition. Change the name to whatever you want, usually the names of the set of tickers.
The Alert message is dyanmic showing which Symbol with each type of alert, at whatever price.
Ability to disable the targets + symbols.
Alerts work by Stop Loss crossing under price and Targets Cross Over. Enabling the "Short" Targets reverses this.
The line that is being displayed is actually the price of the asset being moved over x number of bars. I have not found a way to plot a traditional horizontal line, as the code for it uses a fixed price.
As it being a user input, it is a variable. Any help with this would be appreicated.
Alerts are set to once per bar.
Known bug that sometimes if the prices that you set are inside the current candle stick, then your alert will immeaditally fire, either change the timeframe or let it fire and wait fo
After a target is hit, I reccomend setting the alert to 0 and REMAKING the alert. You MUST REMAKE THE ALERT AFTER ANY CHANGES. This script WILL NOT CHANGE ALERTS AS YOU CHANGE SETTINGS.
TradingView Alerts are not this smart , at least I haven't found a way to do this yet.
חפש סקריפטים עבור "stop loss"
Anti-Volume Stop Loss multi timeframe [LM]Hello Traders,
I would like to introduce you fork of popular indicator Anti-Volume Stop Loss created by Buff Dormeier and cracked here on tradingview by @Rafka so shout out to him. I have tried to crack it myself as well as I'm big fan of Dormeier's work but it's not easy so really big thanks to Rafka
I have refactored original script and have included multi timeframe setting.
As its shown below you can select higher timeframe to track lower one:
Enjoy!
Bitlinc MARSI Study AST w/ Take Profit & Stop loss - beta 0.1This script is beta 0.1 - will update as soon as the script is tradable
This script is based on AST on a 10 minute timeframe. You can change the asset and the timeframe for any asset you want to trade, but for it to work correct ALL settings have to be testes in the Strategy section of the TradingView. Each assets and timeframe require a different mixture of settings. This is NOT a one settings fits all trading for all assets on any timeframe. Below are the settings and explanation on how it works.
How it fires a buy / sell:
The script will plot an RSI with upper and lower bands in a separate indicator window. The idea behind this script is to fire a LONG when MA crosses OVER lower band and fire a SHORT when the MA crosses under the lower band. Each order that fires is an OCO (Order Cancels Order) for pyramiding.
Settings:
You have full control of these settings as mentioned above, you must configure every part of this script for each asset and timeframe you trade.
- Length of MA
- Length
- Upper bands of RSI
- Lower bands of RSI
- Take profit percentage
- Stop loss percentage
- Month to start and end the strategy (within 2020)
- Day to start and end the strategy (within 2020)
- Quantity type
- Slippage
- Pyramiding
***Remember that after the signal to enter or exit a trade is fired, the alert will trigger AFTER the close of the candle that caused the tigger to fire
ATR Stop Loss LONG/SHORT by melihgulerYou can monitor the stop loss level according to ATR in 2 ways (Long/Short).
RSI + EMA+ MTF Stop-LossThis is a simple RSI with multiple MTF (No security) to help with direction short and long-term.
The rsi for the current chart has a noise reduction, while the rest are based on ma's.
I have supplied an extra flexible mtf rsi ma for potential adjustable/long-term stop-loss or direction identification.
Enjoy
RSI Stop LossExperiment for using RSI as a stop loss value, shows where the price will be when the RSI increases or decreases by a specified amount.
poki buy and sell Take profit and stop lossThis indicator is based on modelius model of lazy bear weis model with ATR for the buy=B sell =S
in addition there is Take profit and stop loss in % both for short and for long
next stage is to know the resistance level and support based on bollinger marked in blue and red dots
Also included Parabolic Sar (blue and red dots rising up or down)
The color of bulish or bearish zone is based on the cross of Hull avreage and linear regression ( for each time set may need different setting for accuracy )
So how to use this scrupt to better profit
1. if you have B signal and its on lower support level then its good starting place for buy. look at the Parabolic Sar if its in agreement. The exit can be either by S =sell, Take profit that you decide on % or by end of Parabolic SAR upward
2. exact the oposite for short
Play with setting for the desired results or change modify this script for your purpose
Pivot Stop LossHere we intend to use pivot points for stop loss and take profit. This has the added benefit of helping you to visualize support and resistance levels.
Hull modelius take profit and stop lossThis model has Hull moving average, fibs in form of Bollinger ,SMA and Modelius model with ATR for buy and sell power based on weis volume. Inside alerts for buy and sell. take profit and stop loss for both longs and shorts
so have fun
SL + TP Dynamics - By M.LolasStop Loss e Take Profit dinâmicos para operações semiautomatizadas.
By M.Lolas
STOP-LOSS-RSI with Edge-Preserving Filter Strategy V2Modified RSI strategy with entry and exit points.
I have allowed for High and Low risk for anyone interested in using it (NO GUARANTEES. DO YOUR OWN RESEARCH).
I will later consider incorporating the standard RSI for exit points. I am sure returns will increase based on current test runs :)
Returns look good based on the strategy result.
Delta Zones Smart Money Concept (SMC) UT Trend Reversal Mul.Sig.🚀 What's New in This Version (V5 Update)
This version is a major overhaul focused on improving trade entry timing and risk management through enhanced UT Bot functionality:
Integrated UT Trailing Stop (ATR-based): The primary trend filter and moving stop-loss mechanism is now fully integrated.
Pre-Warning Line: A revolutionary feature that alerts traders when the price penetrates a specific percentage distance (customizable) from the UT Trailing Stop before the main reversal signal fires.
"Ready" Signal: Plots a "Ready" warning label on the chart and triggers an alert condition (UT Ready Long/Short) for pre-emptive trade preparation.
V5 Compatibility: All code has been optimized for Pine Script version 5, utilizing the modern array and type structures for efficient Order Block and Breaker Block detection.
💡 How to Use This Indicator
This indicator works best when confirming signals across different components:
1. Identify the Trend Bias (UT Trailing Stop)
Uptrend: UT Trailing Stop line is Green (Focus only on Buy/Long opportunities).
Downtrend: UT Trailing Stop line is Red (Focus only on Sell/Short opportunities).
2. Prepare for Entry (Warning Line)
Action: When you see the "Ready" label or the price hits the Pre-Warning Line (Dotted Orange Line), this is your alert to prepare for a trend flip, or to tighten the stop on your current trade.
3. Confirm the Entry (Multi-Signals)
Look for a primary entry signal that aligns with the desired trend:
High-Conviction Entry: Wait for the UT Buy/Sell label (confirmed trend flip) AND a Combined Buy/Sell arrow (confirmed by your selected Oscillator settings).
High-Liquidity Entry: Look for a Delta Zone Box forming near an active Order Block or Breaker Block (SMC zones), and then confirm with a UT or Combined Signal.
4. Manage Risk (Trailing Stop)
Always set your initial Stop Loss (SL) either just outside the opposite Order Block or at the UT Trailing Stop level itself.
If the price closes back across the UT Trailing Stop, exit your position immediately, as the trend bias has officially shifted.
Features & Components
1. Delta Zones (Liquidity/Wick Pressure)
Identifies periods of extreme buying or selling pressure based on wick-to-body ratios and standard deviation analysis.
Plots colored pressure boxes (Buy/Sell) to highlight potential exhaustion points or institutional activity.
2. Smart Money Concepts (SMC)
Automatically detects and plots Order Blocks (OBs) and Breaker Blocks (BBs) based on confirmed Market Structure Breaks (MSBs).
Includes Chop Control logic to remove less reliable Breaker Blocks.
3. UT Bot Trailing Stop & Warning Line
UT Trailing Stop (ATR-based): Plots a dynamic trend line (Green/Red) that acts as a moving stop-loss and primary trend filter.
Ready/Warning Signals: Alerts traders (via the "Ready" label and orange lines) when the price enters a "Pre-Reversal Zone" near the Trailing Stop.
4. Multi-Indicator Confirmation (Filters)
Includes customizable signals based on the crossover/crossunder of RSI, CCI, and Stochastic indicators against configurable Overbought/Oversold levels.
Allows selection of combination signals (e.g., RSI & CCI, All Combined, etc.) for high-conviction entries.
Universal Scalper Indicator [Crypto/Forex/Gold]Universal Scalper Pro is an all-in-one scalping system designed for the 15-Minute Timeframe. It automates the analysis of trend, volatility, and risk management into a single, high-contrast dashboard.
Unlike standard crossover indicators, this system filters out low-volatility "noise" using a built-in ADX engine and automatically calculates dynamic Stop Loss and Take Profit levels based on market volatility (ATR).
It is engineered to work universally on:
Crypto (BTC, ETH, SOL, Altcoins)
Commodities (Gold, Silver, Oil)
Forex (Major & Minor Pairs)
Stocks (High volume tech stocks like NVDA, TSLA)
📈 How It Works (The Strategy)
1. The Trend Engine (9/21 EMA) The core logic utilizes a Fast (9) and Slow (21) Exponential Moving Average crossover.
Bullish Signal: The 9 EMA crosses above the 21 EMA.
Bearish Signal: The 9 EMA crosses below the 21 EMA. This specific combination is chosen for its responsiveness to 15-minute intraday trends.
2. The Noise Filter (ADX > 15) To prevent "whipsaws" (fake signals during sideways markets), the script includes a Volatility Filter based on the Average Directional Index (ADX).
Signals are rejected if the ADX is below 15.
This ensures you only receive alerts when there is sufficient momentum to sustain a move.
3. Dynamic Risk Management (ATR) The script uses the Average True Range (ATR) to calculate Stop Loss and Take Profit levels that adapt to the specific asset's volatility.
Stop Loss: Placed at 1.5x ATR from the entry. (Tight enough to preserve capital, wide enough to survive standard market noise).
Take Profit: Placed at 2.0x ATR from the entry. (Provides a healthy 1:1.3 Risk/Reward ratio).
🚀 Key Features
Universal Dashboard: A bottom-right panel displays the live Trend Status, Entry Price, Stop Loss, and Take Profit. It automatically formats decimals for any asset (e.g., 2 decimals for Gold, 5 for Forex, 8 for Crypto).
"Sticky" Memory: The dashboard retains the prices of the last valid signal, allowing you to manage your trade even after the signal candle closes.
Trend Cloud: A visual Green/Red zone between the EMAs helps you instantly identify the market bias.
Unified Alerts: A single alert setup ("Any alert() function call") sends the Asset Name, Entry, SL, and TP directly to your phone.
🛠️ How to Use
Timeframe: Set your chart to 15 Minutes (15m).
Wait for the Signal: Look for the "BUY" (Green) or "SELL" (Red) label on the chart.
Check the Dashboard: Ensure the "STATUS" is BULLISH (for buys) or BEARISH (for sells). If the status says "WAIT", do not trade.
Execute: Enter the trade using the exact Stop Loss and Take Profit levels shown on the dashboard.
⚠️ Risk Disclaimer
Trading financial markets involves high risk and may not be suitable for all investors. This indicator is a technical analysis tool and does not constitute financial advice. Past performance is not indicative of future results. Always practice with a demo account before trading real capital.
EMA Trend Pro v1Here is a clear, professional English description you can copy-paste directly (suitable for sharing with friends, investors, brokers, or posting on TradingView):
EMA Trend Pro v5.0 – Strategy Overview
This is a trend-following strategy designed for 15-minute charts on assets like XAUUSD, NASDAQ, BTC, and ETH.
Entry Rules
Buy when the 7, 14, and 21-period EMAs are aligned upward and the 14-period EMA crosses above the 144-period EMA (with ADX > 20 and volume confirmation).
Sell short when the EMAs are aligned downward and the 14-period EMA crosses below the 144-period EMA.
Risk Management
Initial stop-loss is placed at 1.8 × ATR below (long) or above (short) the entry price.
Position size is calculated to risk a fixed percentage of equity per trade.
Profit-Taking & Trade Management
When price reaches 1:1 reward-to-risk, 30% of the position is closed.
At the same moment, the stop-loss for the remaining 70% is moved to the entry price (breakeven).
The remaining position is split:
50% targets 1:2 reward-to-risk
50% targets 1:3 reward-to-risk (allowing big wins during strong trends)
Visualization
Clean colored bars extend to the right showing entry, stop-loss, and three take-profit levels.
Price labels clearly display "Entry", "SL", "TP1 1:1", "TP2 1:2", and "TP3 1:3".
Only the current trade is displayed for a clean chart.
Key Advantages
High win rate due to breakeven protection after 1R
Excellent reward-to-risk ratio that lets winners run
Fully automated, works on any market with clear trends
Professional look, easy to understand and explain
Perfect for swing traders who want consistent profits with limited downside risk.
Feel free to use this description on TradingView, in your trading journal, or when explaining the strategy to others!
If you want a shorter version (e.g., for TradingView description box) or a Chinese version, just let me know — I’ll give it to you right away! 😊
EMA Trend Pro v5.0 5M ONLY — 策略版(1:1出30%+保本)Here is a clear, professional English description you can copy-paste directly (suitable for sharing with friends, investors, brokers, or posting on TradingView):
EMA Trend Pro v5.0 – Strategy Overview
This is a trend-following strategy designed for 15-minute charts on assets like XAUUSD, NASDAQ, BTC, and ETH.
Entry Rules
Buy when the 7, 14, and 21-period EMAs are aligned upward and the 14-period EMA crosses above the 144-period EMA (with ADX > 20 and volume confirmation).
Sell short when the EMAs are aligned downward and the 14-period EMA crosses below the 144-period EMA.
Risk Management
Initial stop-loss is placed at 1.8 × ATR below (long) or above (short) the entry price.
Position size is calculated to risk a fixed percentage of equity per trade.
Profit-Taking & Trade Management
When price reaches 1:1 reward-to-risk, 30% of the position is closed.
At the same moment, the stop-loss for the remaining 70% is moved to the entry price (breakeven).
The remaining position is split:
50% targets 1:2 reward-to-risk
50% targets 1:3 reward-to-risk (allowing big wins during strong trends)
Visualization
Clean colored bars extend to the right showing entry, stop-loss, and three take-profit levels.
Price labels clearly display "Entry", "SL", "TP1 1:1", "TP2 1:2", and "TP3 1:3".
Only the current trade is displayed for a clean chart.
Key Advantages
High win rate due to breakeven protection after 1R
Excellent reward-to-risk ratio that lets winners run
Fully automated, works on any market with clear trends
Professional look, easy to understand and explain
Perfect for swing traders who want consistent profits with limited downside risk.
Feel free to use this description on TradingView, in your trading journal, or when explaining the strategy to others!
If you want a shorter version (e.g., for TradingView description box) or a Chinese version, just let me know — I’ll give it to you right away! 😊
Trading Pro with Kama Hariss 369Indicators used in strategy are 20 EMA, KAMA, RSI and DMI/ADX and RVOL.
Buy signal activates when price closes above kama and kama is above 20 ema. RSI greater than 55, D+>D- and ADX>20. Kama is upward slopping.
Sell signal activates when price closes below kama and kama is below 20 ema. RSI <45, D+
ProfitView Strategy TemplateHello traders,
This script took me a full week of coding/testing, sweat, and tears - and I’m too nice as I’m giving it for free to the community.
If you're tired of manual trading and looking for a solid strategy template to pair with your indicators, look no further.
This Pine Script v5 strategy template is engineered for maximum customization and risk management.
Best part?
This Pine Script v5 template facilitates the dynamic construction of ProfitView alerts, sparing users the time and effort of mastering the ProfitView syntax and manually creating alert commands.
This powerful tool gives much power to those who don't know how to code in Pinescript and want to automate their indicators' signals via the ProfitView Chrome extension.
IMPORTANT NOTES
ProfitView is a trading bot software that forwards TradingView alerts to your brokers (examples: Binance, Oanda, Coinbase, Bybit, etc.) for automating trading.
Many traders don't know how to dynamically create ProfitView-compatible alerts using the data from their TradingView scripts.
Traders using trading bots want their alerts to reflect the stop-loss/take-profit/trailing-stop/stop-loss to break options from your script and then create the orders accordingly.
This script showcases how to create ProfitView alerts dynamically.
TRADINGVIEW ALERTS
1) You'll have to create one alert per asset X timeframe = 1 chart.
Example: 1 alert for EUR/USD on the 5 minutes chart, 1 alert for EUR/USD on the 15-minute chart (assuming you want your bot to trade the EUR/USD on the 5 and 15-minute timeframes)
2) Select the Order fills and alert() function calls condition
3) For each alert, the alert message is pre-configured with the text below
{{strategy.order.alert_message}}
Please leave it as it is.
It's a TradingView native variable that will fetch the alert text messages built by the script.
4) ProfitView doesn't use webhook technology, so setting a webhook URL from the alerts notifications tab is unnecessary.
KEY FEATURES
I) Modular Indicator Connection
* plug your existing indicator into the template.
* Only two lines of code are needed for full compatibility.
Step 1: Create your connector
Adapt your indicator with only 2 lines of code and then connect it to this strategy template.
To do so:
1) Find in your indicator where the conditions print the long/buy and short/sell signals.
2) Create an additional plot as below
I'm giving an example with a Two moving averages cross.
Please replicate the same methodology for your indicator, whether a MACD , ZigZag, Pivots , higher-highs, lower-lows or whatever indicator with clear buy and sell conditions.
//@version=5
indicator("Supertrend", overlay = true, timeframe = "", timeframe_gaps = true)
atrPeriod = input.int(10, "ATR Length", minval = 1)
factor = input.float(3.0, "Factor", minval = 0.01, step = 0.01)
= ta.supertrend(factor, atrPeriod)
supertrend := barstate.isfirst ? na : supertrend
bodyMiddle = plot(barstate.isfirst ? na : (open + close) / 2, display = display.none)
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color = color.green, style = plot.style_linebr)
downTrend = plot(direction < 0 ? na : supertrend, "Down Trend", color = color.red, style = plot.style_linebr)
fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps = false)
fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps = false)
buy = ta.crossunder(direction, 0)
sell = ta.crossunder(direction, 0)
//////// CONNECTOR SECTION ////////
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title = "Signal", display = display.data_window)
//////// CONNECTOR SECTION ////////
Important Notes
🔥 The Strategy Template expects the value to be exactly 1 for the bullish signal and -1 for the bearish signal
Now, you can connect your indicator to the Strategy Template using the method below or that one.
Step 2: Connect the connector
1) Add your updated indicator to a TradingView chart
2) Add the Strategy Template as well to the SAME chart
3) Open the Strategy Template settings, and in the Data Source field, select your 🔌Connector🔌 (which comes from your indicator)
Note it doesn’t have to be named 🔌Connector🔌 - you can name it as you want - however, I recommend an explicit name you can easily remember.
From then, you should start seeing the signals and plenty of other stuff on your chart.
🔥 Note that whenever you update your indicator values, the strategy statistics and visuals on your chart will update in real-time
II) BOT Risk Management:
- Max Drawdown:
Mode: Select whether the max drawdown is calculated in percentage (%) or USD.
Value: If the max drawdown reaches this specified value, set a value to halt the bot.
- Max Consecutive Days:
Use Max Consecutive Days BOT Halt: Enable/Disable halting the bot if the max consecutive losing days value is reached.
- Max Consecutive Days: Set the maximum number of consecutive losing days allowed before halting the bot.
- Max Losing Streak:
Use Max Losing Streak: Enable/Disable a feature to prevent the bot from taking too many losses in a row.
- Max Losing Streak Length: Set the maximum length of a losing streak allowed.
Margin Call:
- Use Margin Call: Enable/Disable a feature to exit when a specified percentage away from a margin call to prevent it.
Margin Call (%): Set the percentage value to trigger this feature.
- Close BOT Total Loss:
Use Close BOT Total Loss: Enable/Disable a feature to close all trades and halt the bot if the total loss is reached.
- Total Loss ($): Set the total loss value in USD to trigger this feature.
Intraday BOT Risk Management:
- Intraday Losses:
Use Intraday Losses BOT Halt: Enable/Disable halting the bot on reaching specified intraday losses.
Mode: Select whether the intraday loss is calculated in percentage (%) or USD.
- Max Intraday Losses (%): Set the value for maximum intraday losses.
Limit Intraday Trades:
- Use Limit Intraday Trades: Enable/Disable a feature to limit the number of intraday trades.
- Max Intraday Trades: Set the maximum number of intraday trades allowed.
Restart Intraday EA:
- Use Restart Intraday EA: Enable/Disable a feature to restart the bot at the first bar of the next day if it has been stopped with an intraday risk management safeguard.
III) Order Types and Position Sizing
- Choose between market, limit, or stop orders.
- Set your position size directly in the template.
Please use the position size from the “Inputs” and not the “Properties” tab.
I know it's redundant. - the template needs this value from the "Inputs" tab to build the alerts, and the Backtester needs it from the "Properties" tab.
IV) Advanced Take-Profit and Stop-Loss Options
- Choose to set your SL/TP in either pips or percentages.
- Option for multiple take-profit levels and trailing stop losses.
- Move your stop loss to break even +/- offset in pips for “risk-free” trades.
V) Miscellaneous
Retry order openings if they fail.
Order Types:
Select and specify order type and price settings.
Position Size:
Define the type and size of positions.
Leverage:
Leverage settings, including margin type and hedge mode.
Session:
Limit trades to specific sessions.
Dates:
Limit trades to a specific date range.
Trades Direction:
Direction: Specify the market direction for opening positions.
VI) Notifications (Telegram/Discord/Email/IFTTT/Twilio/SMS)
Customize notifications sent to Telegram, Discord, Email, IFTTT, Twilio, and ProfitView Logger.
VII) Logger
The ProfitView commands are logged in the TradingView logger.
You'll find more information about it in this TradingView blog post .
WHY YOU MIGHT NEED THIS TEMPLATE
1) Transform your indicator into a ProfitView trading bot more easily than before
Connect your indicator to the template
Create your alerts
Set your EA settings
2) Save Time
Auto-generated alert messages for ProfitView.
I tested them all and checked with the support team what could/couldn’t be done.
3) Be in Control
Manage your trading risks with advanced features.
4) Customizable
Fits various trading styles and asset classes.
REQUIREMENTS
* Make sure you have your ProfitView account and do the settings correctly in your Chrome extension. If you don't know how to do it, read the documentation + ask for help in the ProfitView Discord support channel.
* If there is any issue with the template, ask me in the comments section - I’ll answer quickly.
BACKTEST RESULTS FROM THIS POST
1) I connected this strategy template to a dummy Supertrend script.
I could have selected any other indicator or concept for this script post.
I wanted to share an example of how you can quickly upgrade your strategy, making it compatible with ProfitView.
2) The backtest results aren't relevant for this educational script publication.
I used realistic backtesting data but didn't look too much into optimizing the results, as this isn't the point of why I'm publishing this script.
This strategy is a template to be connected to any indicator - the sky is the limit. :)
3) This template is made to take 1 trade per direction at any given time.
Pyramiding is set to 1 on TradingView.
The strategy default settings are:
* Initial Capital: 100000 USD
* Position Size: 1%
* Commission Percent: 0.075%
* Slippage: 1 tick
* No margin/leverage used
Best regards,
Dave
TradingView.To Strategy Template (with Dyanmic Alerts)Hello traders,
If you're tired of manual trading and looking for a solid strategy template to pair with your indicators, look no further.
This Pine Script v5 strategy template is engineered for maximum customization and risk management.
Best part?
This Pine Script v5 template facilitates the dynamic construction of TradingView.TO alerts, sparing users the time and effort of mastering the TradingView.TO syntax and manually create alert commands.
This powerful tool gives much power to those who don't know how to code in Pinescript and want to automate their indicators' signals via TradingView.TO bot.
IMPORTANT NOTES
TradingView.TO is a trading bot software that forwards TradingView alerts to your brokers (examples: Binance, Oanda, Coinbase, Bybit, Metatrader 4/5, ...) for automating trading.
Many traders don't know how to create TradingView.TO dynamically-compatible alerts using the data from their TradingView scripts.
Traders using trading bots want their alerts to reflect the stop-loss/take-profit/trailing-stop/stop-loss to break options from your script and then create the orders accordingly.
This script showcases how to create TradingView.TO alerts dynamically.
TRADINGVIEW ALERTS
1) You'll have to create one alert per asset X timeframe = 1 chart.
Example: 1 alert for BTC/USDT on the 5 minutes chart, 1 alert for BTC/USDT on the 15-minute chart (assuming you want your bot to trade the BTC/USDT on the 5 and 15-minute timeframes)
2) Select the Order fills and alert() function calls condition
3) For each alert, the alert message is pre-configured with the text below
{{strategy.order.alert_message}}
Please leave it as it is.
It's a TradingView native variable that will fetch the alert text messages built by the script.
4) TradingView.TO uses webhook technology - setting a webhook URL from the alerts notifications tab is required.
KEY FEATURES
I) Modular Indicator Connection
* plug your existing indicator into the template.
* Only two lines of code are needed for full compatibility.
Step 1: Create your connector
Adapt your indicator with only 2 lines of code and then connect it to this strategy template.
To do so:
1) Find in your indicator where the conditions print the long/buy and short/sell signals.
2) Create an additional plot as below
I'm giving an example with a Two moving averages cross.
Please replicate the same methodology for your indicator, whether a MACD , ZigZag, Pivots , higher-highs, lower-lows or whatever indicator with clear buy and sell conditions.
//@version=5
indicator("Supertrend", overlay = true, timeframe = "", timeframe_gaps = true)
atrPeriod = input.int(10, "ATR Length", minval = 1)
factor = input.float(3.0, "Factor", minval = 0.01, step = 0.01)
= ta.supertrend(factor, atrPeriod)
supertrend := barstate.isfirst ? na : supertrend
bodyMiddle = plot(barstate.isfirst ? na : (open + close) / 2, display = display.none)
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color = color.green, style = plot.style_linebr)
downTrend = plot(direction < 0 ? na : supertrend, "Down Trend", color = color.red, style = plot.style_linebr)
fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps = false)
fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps = false)
buy = ta.crossunder(direction, 0)
sell = ta.crossunder(direction, 0)
//////// CONNECTOR SECTION ////////
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title = "Signal", display = display.data_window)
//////// CONNECTOR SECTION ////////
Important Notes
🔥 The Strategy Template expects the value to be exactly 1 for the bullish signal and -1 for the bearish signal
Now, you can connect your indicator to the Strategy Template using the method below or that one.
Step 2: Connect the connector
1) Add your updated indicator to a TradingView chart
2) Add the Strategy Template as well to the SAME chart
3) Open the Strategy Template settings, and in the Data Source field, select your 🔌Connector🔌 (which comes from your indicator)
Note it doesn’t have to be named 🔌Connector🔌 - you can name it as you want - however, I recommend an explicit name you can easily remember.
From then, you should start seeing the signals and plenty of other stuff on your chart.
🔥 Note that whenever you update your indicator values, the strategy statistics and visuals on your chart will update in real-time
II) BOT Risk Management:
- Max Drawdown:
Mode: Select whether the max drawdown is calculated in percentage (%) or USD.
Value: If the max drawdown reaches this specified value, set a value to halt the bot.
- Max Consecutive Days:
Use Max Consecutive Days BOT Halt: Enable/Disable halting the bot if the max consecutive losing days value is reached.
- Max Consecutive Days: Set the maximum number of consecutive losing days allowed before halting the bot.
- Max Losing Streak:
Use Max Losing Streak: Enable/Disable a feature to prevent the bot from taking too many losses in a row.
- Max Losing Streak Length: Set the maximum length of a losing streak allowed.
Margin Call:
- Use Margin Call: Enable/Disable a feature to exit when a specified percentage away from a margin call to prevent it.
Margin Call (%): Set the percentage value to trigger this feature.
- Close BOT Total Loss:
Use Close BOT Total Loss: Enable/Disable a feature to close all trades and halt the bot if the total loss is reached.
- Total Loss ($): Set the total loss value in USD to trigger this feature.
Intraday BOT Risk Management:
- Intraday Losses:
Use Intraday Losses BOT Halt: Enable/Disable halting the bot on reaching specified intraday losses.
Mode: Select whether the intraday loss is calculated in percentage (%) or USD.
- Max Intraday Losses (%): Set the value for maximum intraday losses.
Limit Intraday Trades:
- Use Limit Intraday Trades: Enable/Disable a feature to limit the number of intraday trades.
- Max Intraday Trades: Set the maximum number of intraday trades allowed.
Restart Intraday EA:
III) Order Types and Position Sizing
- Choose between market or limit orders.
- Set your position size directly in the template.
Please use the position size from the “Inputs” and not the “Properties” tab.
I know it's redundant. - the template needs this value from the "Inputs" tab to build the alerts, and the Backtester needs it from the "Properties" tab.
IV) Advanced Take-Profit and Stop-Loss Options
- Choose to set your SL/TP in either USD or percentages.
- Option for multiple take-profit levels and trailing stop losses.
- Move your stop loss to break even +/- offset in USD for “risk-free” trades.
V) Miscellaneous:
Retry order openings if they fail.
Order Types:
Select and specify order type and price settings.
Position Size:
Define the type and size of positions.
Leverage:
Leverage settings, including margin type and hedge mode.
Session:
Limit trades to specific sessions.
Dates:
Limit trades to a specific date range.
Trades Direction:
Direction: Specify the market direction for opening positions.
VI) Logger
The TradingView.TO commands are logged in the TradingView logger.
You'll find more information about it in this TradingView blog post .
WHY YOU MIGHT NEED THIS TEMPLATE
1) Transform your indicator into a TradingView.TO trading bot more easily than before
Connect your indicator to the template
Create your alerts
Set your EA settings
2) Save Time
Auto-generated alert messages for TradingView.TO.
I tested them all and checked with the support team what could/couldn’t be done.
3) Be in Control
Manage your trading risks with advanced features.
4) Customizable
Fits various trading styles and asset classes.
REQUIREMENTS
* Make sure you have your TradingView.TO account
* If there is any issue with the template, ask me in the comments section - I’ll answer quickly.
BACKTEST RESULTS FROM THIS POST
1) I connected this strategy template to a dummy Supertrend script.
I could have selected any other indicator or concept for this script post.
I wanted to share an example of how you can quickly upgrade your strategy, making it compatible with TradingView.TO.
2) The backtest results aren't relevant for this educational script publication.
I used realistic backtesting data but didn't look too much into optimizing the results, as this isn't the point of why I'm publishing this script.
This strategy is a template to be connected to any indicator - the sky is the limit. :)
3) This template is made to take 1 trade per direction at any given time.
Pyramiding is set to 1 on TradingView.
The strategy default settings are:
* Initial Capital: 100000 USD
* Position Size: 1%
* Commission Percent: 0.075%
* Slippage: 1 tick
* No margin/leverage used






















